#include "stdafx.h"
#include "GraphicalEntity.hpp"

namespace graphicalactors
{

    GraphicalEntity::GraphicalEntity() :
        m_node(NULL)
	{

	}

	GraphicalEntity::~GraphicalEntity()
	{
        if (m_node)
            m_node->remove();
	}

    void GraphicalEntity::init( irr::video::IVideoDriver * _driver, irr::scene::ISceneManager * _sceneManager, const irr::core::vector3df& _position, const std::string& _meshName, const std::string& _textureName )
    {
        //load a mesh and load texture
        m_node = _sceneManager->addMeshSceneNode(
                _sceneManager->getMesh(_meshName.c_str()) );
        m_node->setMaterialTexture(0, _driver->getTexture(_textureName.c_str()));
        m_node->setMaterialFlag(irr::video::EMF_LIGHTING, false);
        m_node->setPosition( _position );
    }
}